<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }
    </style>
</head>

<body>

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <div class="layui-container">
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

            <div class="layui-form-item">
                <label class="layui-form-label"><b style="color:red">*</b><fmt:message key='zzpz'/></label>
                <div class="layui-input-inline" style="width: 70%;">
                    <input type="hidden" name="image" id="image">
                    <a type="button" id="chooseImage" class="layui-btn layui-btn-sm layui-btn-normal"><fmt:message key='sctp'/></a>
                    <div id="imageBox">

                    </div>
                </div>
            </div>

            <div class="layui-form-item confirm-line">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="button" style="display: none;" value="确定" id="submit" lay-filter="submit" class="layui-btn">
                </div>
            </div>
        </div>
    </div>
</div>


<div style="display: none;">
    <form action="${web_domain}/upload/image" method="post" id="uploadImage" enctype="multipart/form-data">
        <input id="uploadImageFile" name="file" type="file" accept="image/*"/>
    </form>
</div>


<script>


    layui.use(['form'], function () {

        var form = layui.form;

        $("#chooseImage").click(function () {
            $("#uploadImageFile").click();
        });

        $("#uploadImageFile").change(function () {
            $("#uploadImage").ajaxSubmit({
                dataType: "JSON",
                success: function (result) {
                    if (result.status) {
                        $("#image").attr("value", result.path);
                        $("#imageBox").html("<img class='preview' src='${store_domain}/uploads/" + result.path + "' style='width:120px;margin-top:10px;' />'");
                    }
                },
                error: function (result) {
                    console.log(result.responseText);
                }
            });
        });

        $("#submit").click(function () {
            var image = $("#image").val();
            if (!image) {
                layer.alert("<fmt:message key='qscpz'/>");
                return;
            }
            feijin.put({
                url: "${web_domain}/mall/distribution/withdraw/checkBankCardWithdraw",
                data: {"status": 4, "ids": "${ids}", "image": image},
                success: function () {
                    parent.location.reload();
                }
            });
        });

    });
</script>
</body>
</fmt:bundle>
</html>